/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Bean;

import Model.Business.Business;
import Model.Entity.Book;
import Model.Entity.Category;
import java.util.ArrayList;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

/**
 *
 * @author CUONGTROC
 */
@ManagedBean
@RequestScoped
public class CategoryBean {

    /** Creates a new instance of CategoryBean */
    public CategoryBean() {
    }
    ArrayList<Category> categories;
    ArrayList<Book> books;

    public ArrayList<Book> getBooks() {
        return books;
    }

    public void setBooks(ArrayList<Book> books) {
        this.books = books;
    }
    public ArrayList<Category> getCategories() {
        return categories;
    }

    public void setCategories(ArrayList<Category> categories) {
        this.categories = categories;
    }
    private String CategoryID;

    public String getCategoryID() {
        return CategoryID;
    }

    public void setCategoryID(String CategoryID) throws Exception {
        this.CategoryID = CategoryID;
        
    }
    public ArrayList<Category> getAllCategory()throws Exception{
        categories=Business.getAllCategory();
        return categories;
    }
    
    public ArrayList<Book> getAllBookByCategoryID()throws Exception{
        books=Business.bookByCategory(CategoryID);
        return books;
    }
}
